<html>
<head>
    <title>鼠标点击特效</title>
    <style>
        .main {
            color: #fff;
            width: 600px;
            margin: 0 auto;
            text-align: center;
            font-size: 30px;
            font-weight: 900;
            font-family: 'Comic Sans MS', 'Open Sans', 'Microsoft Yahei', 'Microsoft Yahei', -apple-system, sans-serif;
            z-index: 999;
        }

        * {
            cursor: pointer;
            background-color: #ccc;
        }
    </style>
    <link rel="stylesheet" href="libs/shake.css">
    <link rel="stylesheet" href="libs/animate.min.css">
</head>
<body>
<div class="main">
    点击鼠标查看效果
</div>
<script src="libs/jquery-3.4.1.min.js"></script>
<script src="libs/anime.min.js"></script>
<script>
    $("html,body").click(function (e) {
        var gcd = new Array("♥", "♥", "♥");
        var n = Math.floor(Math.random() * gcd.length);
        var $i = $("<b/>").text(gcd[n]);
        var x = e.pageX,
            y = e.pageY;
        $i.css({
            "z-index": 99999,
            "top": y - 20,
            "left": x - 8,
            "position": "absolute",
            "color": "#FF706C",
            "animation": 'heartbeat .25s infinite .15s'
        });
        $("body").append($i);
        $i.animate({
            "opacity": 0
        }, 1500, function () {
            $i.remove()
        });
        e.stopPropagation()
    });
</script>

</body>
</html>
